package com.doone.telmarket.infrastructure.dao.impl;

import java.util.List;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Service;

import com.doone.telmarket.domain.Promotion;
import com.doone.telmarket.infrastructure.dao.PromotionDAO;
import com.ibatis.sqlmap.client.SqlMapClient;
@Service("promotionDAO")
public class PromotionDAOImpl extends SqlMapClientDaoSupport implements PromotionDAO {

	public void deleteByPrimaryKey(int key) {
		getSqlMapClientTemplate().delete("Promotion.deleteByPrimaryKey", key);
	}

	public void insertPromotion(Promotion pro) {
		getSqlMapClientTemplate().insert("Promotion.insertPromotion", pro);
	}

	@SuppressWarnings("unchecked")
	public List<Promotion> selectAllPromotion() {
		List<Promotion> list = getSqlMapClientTemplate().queryForList("Promotion.selectAllPromotion");
		return list;
	}

	public void updatePromotion(Promotion pro) {
		getSqlMapClientTemplate().update("Promotion.updatePromotion", pro);
	}
	
	@Autowired
	public void setSqlMapClientBase(SqlMapClient sqlMapClient) {
		super.setSqlMapClient(sqlMapClient);
	}

}
